import { debounce } from "common/utils.js";
import BackTop from "components/content/backTop/BackTop";

export const itemListenerMixin = {
	data() {
		return {
			itemImgListener: null
		}
	},
	mounted() {
		const refresh = debounce(this.$refs.scroll.refresh, 10);
		this.itemImgListener = () => {
			refresh();
		}
		this.$bus.$on('imageLoad', this.itemImgListener);
	}
}

export const backTopMixin = {
	data() {
		return {
			isShowBackTop: false
		}
	},
	methods: {
		backClick() {
			this.$refs.scroll.scrollTo(0, 0, 500);
		}
	},
	components: {
		BackTop
	}
}